package com.shuoyue.ycgk.base.baseadapter;

import android.view.View;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public abstract class AppBaseQuickAdapter<T> extends BaseQuickAdapter<T, BaseViewHolder> {


    public AppBaseQuickAdapter(@Nullable List<T> data) {
        super(data);
    }

    public AppBaseQuickAdapter(int layoutResId, @Nullable List<T> data) {
        super(layoutResId, data);
    }



    public void resetData(ArrayList<T> data) {
        resetData((List<T>) data);
    }

    public void resetData(List<T> data) {
        if (data != null) {
            mData = data;
        } else {
            mData = new ArrayList<>();
        }
        notifyDataSetChanged();
    }

    public void addData(List<T> data) {
        if (data == null) {
            return;
        }
        if (mData == null) {
            mData = new ArrayList<T>();
        }
        mData.addAll(data);
        notifyDataSetChanged();
    }

    public void clear() {

        if (mData == null) {
            mData = new ArrayList<T>();
        }
        mData.clear();
        notifyDataSetChanged();
    }


}
